import React,{Component} from 'react';
import {Switch,Route,Redirect} from 'react-router-dom'
import {connect} from 'react-redux'

import Home from './home'
import AddUpdate from './add-update'
import Detail from './detail';

export default class Commodity extends Component{
    render() {
        return(
           <Switch>
                <Route path= '/product/commodity' component={Home} exact></Route>{//路径完全匹配才进行显示，不然当是下面的请求路径的时候
                    //根据前面两层就会匹配到这一个组件，就会去这个组件中寻找下一层路由，这样就找不到了
                }
                <Route path= '/product/commodity/add-update' component={AddUpdate}></Route>
                <Route path= '/product/commodity/detail' component={Detail}></Route>
                <Redirect to='/product/commodity'/>
           </Switch>
        )
    }
}
